<!DOCTYPE html>
<html class="x-admin-sm">
	<head>
		<meta charset="UTF-8">
		<title>欢迎页面-X-admin2.2</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<link rel="stylesheet" href="../css/font.css">
		<link rel="stylesheet" href="../css/xadmin.css">
		<script src="../lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="../js/xadmin.js"></script>
		<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/app.js" type="text/javascript" charset="utf-8"></script>
<!--		<script src="../js/welcome.js" type="text/javascript" charset="utf-8"></script>-->

	</head>
	<body>
		<div class="layui-fluid">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-body ">
							<blockquote class="layui-elem-quote">欢迎用户：
								<span class="x-red" id="username">test</span> ！
							</blockquote>
						</div>
					</div>
				</div>


				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-header">个人信息</div>
						<div class="layui-card-body ">
							<table class="layui-table">
								<tbody id="Info_table">
									<tr>
										<th>姓名</th>
										<td id="your_name"></td>
									</tr>
									<tr>
										<th>年龄</th>
										<td id="age">x.xuebingsi.com</td>
									</tr>
									<tr>
										<th>性别</th>
										<td id="sex">WINNT</td>
									</tr>
									<tr>
										<th>工号</th>
										<td id="workId">5.6.27</td>
									</tr>
									<tr>
										<th>角色</th>
										<td id="role">Apache/2.4.23 (Win32) OpenSSL/1.0.2j mod_fcgid/2.3.9</td>
									</tr>
									<tr>
										<th>权限</th>
										<td id="permission">cgi-fcgi</td>
									</tr>
									<tr>
										<th>操作</th>
										<td>
											<button type="button" class="layui-btn" onclick="change_password()">修改密码</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-header">开发团队</div>
						<div class="layui-card-body ">
							<table class="layui-table">
								<tbody>
									<tr>
										<th>版权所有</th>
										<td>四川农业大学物联网工程前端工作室
											<a href="https://www.sicau.edu.cn/" target="_blank" style="color: brown;">访问官网</a></td>
									</tr>
									<tr>
										<th>开发者</th>
										<td>四川农业大学物联网工程前端工作室成员</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<style id="welcome_style"></style>
			</div>
		</div>
		</div>
	<script>
       var userInfo = app.getUserGlobalInfo();
       var managerInfo = app.getManagerGlobalInfo();
	   var your_name = $('#your_name');
	   var sex = $('#sex');
	   var age = $('#age');
	   var workId = $('#workId');
	   var role = $('#role');
	   var permission = $('#permission');

	   // 员工基本信息
       if (userInfo != null){
		   var username = $('#username');
		   username.text(userInfo.username);
		   your_name.text(userInfo.username);
		   if (userInfo.sex == 0){
			   sex.text('女');
		   }else if (userInfo.sex == 1){
			   sex.text('男');
		   }else {
			   sex.text('未知');
		   }
		   age.text(userInfo.age);
		   workId.text(userInfo.workId);
		   role.text(userInfo.role);
		   var permission_str = '';
		   for (let i = 0;i<userInfo.permissionRecordPoList.length;i++){
		   	let permission = userInfo.permissionRecordPoList[i];
			   permission_str += permission.description + "  ";
		   }
		   permission.text(permission_str);

	   }

       // 管理员基本信息
       if (managerInfo != null){
		   var username = $('#username');
		   username.text(managerInfo.manager);
		   your_name.text(managerInfo.manager);
		   if (managerInfo.sex == 0){
			   sex.text('女');
		   }else if (managerInfo.sex == 1){
			   sex.text('男');
		   }else {
			   sex.text('/');
		   }
		   age.text('/');
		   workId.text(managerInfo.workId);
		   role.text(managerInfo.manager);
		   var permission_str = '';
		   for (let i = 0;i<managerInfo.permissionRecordPoList.length;i++){
			   let permission = managerInfo.permissionRecordPoList[i];
			   permission_str += permission.description + "  ";
		   }
		   permission.text(permission_str);
	   }

       function change_password() {
		   layui.use(['layer'], function() {
			   var layer = layui.layer;

			   layer.open({
				   type: 2 //Page层类型
				   , area: ['500px', '300px']
				   , title: '修改密码'
				   , shade: 0.6 //遮罩透明度
				   , maxmin: true //允许全屏最小化
				   , anim: 1 //0-6的动画形式，-1不开启
				   , content: 'change_password.html'
                   ,yes:function () {
                       
                   }
			   });

		   });
	   }
	</script>
	</body>
</html>
